<?php

namespace PAT\WishlistBundle\Entity;

use Doctrine\ORM\Mapping as ORM;

/**
 * PAT\WishlistBundle\Entity\Wishlist
 *
 * @ORM\Table()
 * @ORM\Entity(repositoryClass="PAT\WishlistBundle\Entity\WishlistRepository")
 */
class Wishlist
{
    /**
     * @var integer $id
     *
     * @ORM\Column(name="id", type="integer")
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    private $id;
	
	/**
     * @ORM\ManyToMany(targetEntity="PAT\ProductBundle\Entity\Product")
     */
	 private $products;
	 
	 /**
     * @ORM\ManyToOne(targetEntity="PAT\UserBundle\Entity\User", inversedBy="wishlists")
	 * @ORM\JoinColumn(nullable=false)
     */
    private $user;
    
    /**
	 * @ORM\Column(type="text")
	 *
	 */
    private $name;

    /**
     * Get id
     *
     * @return integer 
     */
    public function getId()
    {
        return $this->id;
    }
    /**
     * Constructor
     */
    public function __construct()
    {
        $this->products = new \Doctrine\Common\Collections\ArrayCollection();
    }
    
    /**
     * Add products
     *
     * @param PAT\WishlistBundle\Entity\Product $products
     * @return Wishlist
     */
    public function addProduct(\PAT\ProductBundle\Entity\Product $products)
    {
        $this->products[] = $products;
        
        return $this;
    }

    /**
     * Remove products
     *
     * @param PAT\WishlistBundle\Entity\Product $products
     */
    public function removeProduct(\PAT\ProductBundle\Entity\Product $products)
    {
        $this->products->removeElement($products);
    }

    /**
     * Get products
     *
     * @return Doctrine\Common\Collections\Collection 
     */
    public function getProducts()
    {
        return $this->products;
    }

    /**
     * Set user
     *
     * @param PAT\UserBundle\Entity\User $user
     * @return Wishlist
     */
    public function setUser(\PAT\UserBundle\Entity\User $user = null)
    {
        $this->user = $user;
    
        return $this;
    }

    /**
     * Get user
     *
     * @return PAT\UserBundle\Entity\User 
     */
    public function getUser()
    {
        return $this->user;
    }

    /**
     * Set name
     *
     * @param string $name
     * @return Wishlist
     */
    public function setName($name)
    {
        $this->name = $name;
    
        return $this;
    }

    /**
     * Get name
     *
     * @return string 
     */
    public function getName()
    {
        return $this->name;
    }
}